﻿using ApiLib.AppStart;
using SqlSugar;

namespace ApiLib.Models;

/// <summary>
/// 文件上传
///</summary>
[Tenant(GlobalConstants.MainDbConfigId), SugarTable("sys_file_info")]
public class SysFileInfo: BaseEntityIdentity
{
    /// <summary>
    /// 文件名 
    ///</summary>
    [SugarColumn(ColumnName = "name")]
    public string Name { get; set; }

    /// <summary>
    /// 名称 
    ///</summary>
    [SugarColumn(ColumnName = "key")]
    public string Key { get; set; }
    
    /// <summary>
    /// 唯一性
    /// </summary>
    [SugarColumn(ColumnName = "hash")]
    public string Hash { get; set; }

    /// <summary>
    /// 版本 
    ///</summary>
    [SugarColumn(ColumnName = "version")]
    public string Version { get; set; }

    /// <summary>
    /// 地址 
    ///</summary>
    [SugarColumn(ColumnName = "path")]
    public string Path { get; set; }

    /// <summary>
    /// 文件大小 
    ///</summary>
    [SugarColumn(ColumnName = "length")]
    public long? Length { get; set; }

    /// <summary>
    /// 文件后缀 
    ///</summary>
    [SugarColumn(ColumnName = "ext")]
    public string Ext { get; set; }

    /// <summary>
    /// 备注 
    ///</summary>
    [SugarColumn(ColumnName = "remark")]
    public string Remark { get; set; }

    /// <summary>
    /// 状态1 - 正在编辑文档，2 - 文档已准备好保存，3 - 发生文档保存错误，4 - 文档已关闭，没有任何更改，6 - 正在编辑文档，但保存了当前文档状态，7 - 强制保存文档时发生错误。 
    ///</summary>
    [SugarColumn(ColumnName = "status")]
    public int Status { get; set; }


    /// <summary>
    /// 所有人 
    ///</summary>
    [SugarColumn(ColumnName = "owner")]
    public string Owner { get; set; }

    /// <summary>
    /// 可以编辑 
    ///</summary>
    [SugarColumn(ColumnName = "editors")]
    public string Editors { get; set; }

    /// <summary>
    /// 可以查看：默认所有人可以查看 
    ///</summary>
    [SugarColumn(ColumnName = "viewers")]
    public string Viewers { get; set; }

    /// <summary>
    /// 是否删除 
    /// 默认值: b'0'
    ///</summary>
    [SugarColumn(ColumnName = "is_delete")]
    public bool IsDelete { get; set; }

    /// <summary>
    /// 历史信息
    /// </summary>
    [SugarColumn(IsIgnore = true)]
    public List<SysFileHistoryInfo> HistoryInfos { get; set; }
}